﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Data;
using System.Text.Json;
using ViewModel;

namespace webapi.Controllers
{
    [Route("[controller]")]
    [ApiController]
    public class VipController : ControllerBase
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns>???</returns>
        [HttpPost(Name = "Post")]
        public IActionResult Post([FromBody] InputModel model)
        {
            if (!ModelState.IsValid)
            {
                // 模型验证失败，返回错误响应
                var errors = ModelState.Values.SelectMany(v => v.Errors)
                                              .Select(e => e.ErrorMessage)
                                              .ToList();
                return BadRequest(errors);
            }

            return Ok(model);
        }

    }


}
